<?php
// +----------------------------------------------------------------------
// | Tpli [ WE ONLY DO WHAT IS NECESSARY ]
// +----------------------------------------------------------------------
// | Author 荒年 < 931274989@qq.com >
// +----------------------------------------------------------------------
// | Explain 网站设置模型
// +----------------------------------------------------------------------
namespace app\admin\model;

use think\Model;

class Article extends Model
{
  public function cates()
  {
    //关联栏目表一对一
    return $this->belongsTo('cate','cate_id','id');
  }

  public function getArticle()
  {
    $result = $this->paginate(20);
    return $result;
  }

  public function add($post)
  {
    $result = $this->allowField(true)->save($post);
    return $result;
  }

  public function edit($post,$id)
  {
    $result = $this->allowField(true)->save($post,['id'=>$id]);
    return $result;
  }
  
}
?>